import request from "@renderer/utils/request"
// 判断是开发环境还是生产环境
const isDev = process.env.NODE_ENV === 'development'
export const getMoHuList = (params: any): any => request({
    url: isDev === true ? '/mohu/pic.php' : 'https://img.moehu.org/pic.php',
    method: 'GET',
    params
})

export const getSearchImgs = (params: any): any => request({
    url: isDev === true ? '/apihzBase/api/img/apihzimgbaidu.php' : 'https://cn.apihz.cn/api/img/apihzimgbaidu.php',
    method: 'GET',
    params
})

// 不分类获取所有图片
export const getAllMobileImgs = (params: any): any => request({
    url: isDev === true ? '/mobeilImg/v1/vertical/vertical' : 'http://service.picasso.adesk.com/v1/vertical/vertical',
    method: 'GET',
    params
})

// 获取图片分类 
export const getImgClassify = (): any => request({
    url: isDev === true ? '/mobeilImg/v1/vertical/category' : 'http://service.picasso.adesk.com/v1/vertical/category',
    method: 'GET'
})

// 获取图片分类下的图片
export const getImgClassifyImgs = (params: any): any => request({
    url: isDev === true ? `/mobeilImg/v1/vertical/category/${params.id}/vertical` : `http://service.picasso.adesk.com/v1/vertical/category/${params.id}/vertical`,
    method: 'GET',
    params
})


// 获取360图片分类
export const get360ImgClassify = (): any => request({
    url: isDev === true ? '/360img' : 'http://cdn.apc.360.cn/index.php',
    method: 'GET',
    params: {
        c: 'WallPaper',
        a: 'getAllCategoriesV2',
        from: '360chrome',
    }
})

// 获取360图片分类下的图片
export const get360ImgClassifyImgs = (params: any): any => request({
    url: isDev === true ? '/360img' : 'http://cdn.apc.360.cn/index.php',
    method: 'GET',
    params: {
        c: 'WallPaper',
        a: 'getAppsByCategory',
        from: '360chrome',
        cid: params.cid,
        start: params.start,
        count: params.count,
    }
})


// 获取pexels图片
export const getPexelsImgs = (params: any): any => request({
    url: isDev === true ? '/mypexels/v1/curated' : 'https://api.pexels.com/v1/curated',
    method: 'GET',
    headers: {
        Authorization: params.key
    },
    params: {
        page: params.page,
        per_page: params.per_page
    }
})

// 获取Bing每日壁纸
export const getBingImgs = (): any => request({
    url: isDev === true ? '/Bing-Wallpaper-Action/main/data/zh-CN_all.json' : 'https://raw.onmicrosoft.cn/Bing-Wallpaper-Action/main/data/zh-CN_all.json',
    method: 'GET'
})

// 获取4k壁纸分类
export const get4kWallpaperClassify = (params: any = {}): any => request({
    url: isDev === true ? '/4kWallpaper/api/4k.php' : 'http://api.yujn.cn/api/4k.php',
    method: 'GET',
    params
})


// https://imgapi.lie.moe/random  萌える嘘 壁纸
export const getMoeImg = (params: any): any => request({
    url: isDev === true ? '/moeImg' : 'https://imgapi.lie.moe/random',
    method: 'GET',
    params
})